package main.state;

public class SadState implements State {

    private Person p;

    public SadState(Person p) {
	super();
	this.p = p;
    }

    @Override
    public void sayHello() {
	System.out.println("Sad hello");
	if (p.getHelloCount() % 2 == 0) {
	    p.setState(p.getHappyState());
	}
    }

    @Override
    public void sayGoodbye() {
	System.out.println("Sad goodbye");
    }

}
